package de.softwareforge.published.proxy;

/*
 * Copyright (C) 2007-2008 Henning P. Schmiedehausen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.lang.reflect.Method;


/**
 * A generic invoker interface for the Proxy factory.
 *
 * @author <a href="mailto:henning@schmiedehausen.org">Henning P. Schmiedehausen</a>
 * @version $Id: Invoker.java 102 2008-02-24 22:14:11Z hps@intermeta.de $
 * @api.level published unstable
 */
public interface Invoker
{

    /**
     * Invokes the given method using an implemented stategy.
     *
     * @param target The target object itself.
     * @param method The method that should be invoked.
     * @param args The method arguments.
     *
     * @return The result of the method invocation.
     *
     * @throws Throwable When the underlying method threw an exception.
     */
    Object invoke(Object target, Method method, Object[] args) throws Throwable;
}
